{if condition="$id"}
<form method="post">
    <table>
        <input value="{$id}" name="id" type="hidden">
        <tr><td>新密码:</td><td><input type="password" name="psw" id="psw" required></td></tr>
        <tr><td>确认密码:</td><td><input type="password" name="psw" onchange="getpassword2(this)" required></td></tr>
        <tr><td></td><td><input type="submit"></td></tr>
    </table>
</form>
{/if}

<script>
    function getpassword2(i) {
        var psw=document.getElementById('psw').value;
        if (psw!==i.value){
            alert('两次密码不一致');
            i.value='';
            i.focus();
        }
    }
</script>